package com.examsage.examsage.controller;

import com.examsage.examsage.model.vo.ResponseVO;
import com.examsage.examsage.service.IMajorApplicationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author examsage
 * @since 2025-07-02
 */
@RestController
@RequestMapping("/api/v1/major-applications")
public class MajorApplicationController {

    @Autowired
    private IMajorApplicationService majorApplicationService;

    @GetMapping("/")
    ResponseVO selectMajorApplication(int page, int size, String studentName, String idCardNo, int majorPlanId, String status) {
        return majorApplicationService.selectMajorApplication(page, size, studentName, idCardNo, majorPlanId, status);
    }

    @PutMapping("/{id}/approve")
    ResponseVO approveMajorApplication(@PathVariable int id, String notes) {
        return majorApplicationService.approveMajorApplication(id, notes);
    }

    @PutMapping("/{id}/reject")
    ResponseVO rejectMajorApplication(@PathVariable int id, String notes) {
        return majorApplicationService.rejectMajorApplication(id, notes);
    }


}
